<style type="text/css">
	#ajaxModal{z-index: 799!important;}
</style>
<form class="form-horizontal form-validate" action="{php echo web_url('goodshouse/category/cateEdit',['id'=>$id,'plugin'=>$plugin])}" method="post" enctype="multipart/form-data">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button data-dismiss="modal" class="close" type="button">×</button>
				<h4 class="modal-title">编辑分类</h4>
			</div>
			<div class="modal-body form-horizontal">
				<div class="form-group">
					<div class="col-sm-2 control-label">分类图片</div>
					<div class="col-sm-9">
						<div class="input-group img-item">
							<div class="input-group-addon">
								<img src="{php echo tomedia($info['thumb'])}" id="pimg-data_thumb_" style="height:16px;width:16px" />
							</div>
							<input type="text" class="form-control" name="data[thumb]" id="cimg-data_thumb_" value="{$info['thumb']}"/>
							<div class="input-group-btn">
								<button type="button" class="btn btn-default"
										data-toggle="selectAttachment"
										data-input="#cimg-data_thumb_"
										data-img="#pimg-data_thumb_">选择图片</button>
							</div>
						</div>
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-2 control-label">分类名称</div>
					<div class="col-sm-9">
						<input class="form-control" placeholder="请输入分类名称" name="data[name]" value="{$info['name']}" />
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-2 control-label">分类排序</div>
					<div class="col-sm-9">
						<input class="form-control" placeholder="请输入分类排序" name="data[sort]" value="{$info['sort']}" />
					</div>
				</div>
			</div>
			<div class="modal-footer">
                <button class="btn btn-primary" type="submit">提交</button>
                <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
			</div>
		</div>
	</div>
</form>
<script>
	require(['jquery', 'util'], function ($, util) {
		$('.btn-select-pic').unbind('click').click(function () {
			var imgitem = $(this).closest('.img-item');
			util.image('', function (data) {
				imgitem.find('img').attr('src', data['url']);
				imgitem.find('input').val(data['attachment']);
			});
		});
	});
</script>